package com.atguigu.mock.entity;

import com.atguigu.common.base.entity.AutoIdBase;
import com.atguigu.common.comment.Comment;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import java.time.LocalDateTime;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Comment("行业表")
public class Industry extends AutoIdBase {

    @Comment("行业名称")
    private String industryName;

    @Comment("行业级别")
    private Integer industryLevel;

    @Comment("上级行业ID")
    @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH})
    private Industry superiorIndustry;

    public Industry(LocalDateTime createTime, String industryName, Integer industryLevel, Industry superiorIndustry) {
        super(createTime);
        this.industryName = industryName;
        this.industryLevel = industryLevel;
        this.superiorIndustry = superiorIndustry;
    }
}
